package com.fanjun.learning.multithread.Thread_Per_Message_Pattern;

/**
 * <p>委托执行的类</p>
 */
public class Host {
    private final Helper helper = new Helper();
    public void request(final int count, final char c) {
        System.out.println("request(" + count + "," + c + " begin)");
        new Thread(){
            @Override
            public void run(){
                // 在使用匿名内部类时,用到方法的局部变量或参数时,要将变量声明成final类型,否则编译通不过
                helper.handle(count, c);
            }
        }.start();
        System.out.println("request(" + count + "," + c + " end)");
    }
}
